<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>retro-205 Emulator Diagnostic Panel</title>
<!--
/***********************************************************************
* retro-205/D205DiagPanel.html
************************************************************************
* Copyright (c) 2015, Paul Kimpel.
* Licensed under the MIT License, see
*       http://www.opensource.org/licenses/mit-license.php
************************************************************************
* ElectroData/Burroughs Datatron 205 emulator diagnostic monitoring panel.
************************************************************************
* 2015-02-28  P.Kimpel
*   Original version, from D205.html.
***********************************************************************/
-->
<meta name="Author" content="Paul Kimpel">
<meta http-equiv="Content-Script-Type" content="text/javascript">
<meta http-equiv="Content-Style-Type" content="text/css">
<link id=defaultStyleSheet rel=stylesheet type="text/css" href="D205Common.css">
<link id=diagStyleSheet rel=stylesheet type="text/css" href="D205.css">

<script>
window.addEventListener("load", function(ev) {
    var body = document.getElementById("DiagBody");
    var delayDevNodes = {};
    var getCallbackState = window.global.getCallbackState;
    var intervalPeriod = 100;           // milliseconds
    var intervalToken = 0;

    function refreshCallbackStats() {
        /* Obtains the current "delayDev" has from the SetCallback mechanism and
        formats the data to DiagBody */
        var cat;
        var cell;
        var textNode;
        var delayDev;
        var e;
        var row;
        var state;

        state = getCallbackState(0x01); // get delayDev hash only
        delayDev = state.delayDev;
        for (cat in delayDev) {
            textNode = delayDevNodes[cat];
            if (!textNode) {
                row = document.createElement("tr");
                cell = document.createElement("td");
                cell.className = "rj";
                textNode = document.createTextNode("");
                delayDevNodes[cat] = textNode;
                cell.appendChild(textNode);
                row.appendChild(cell);
                cell = document.createElement("td");
                cell.appendChild(document.createTextNode(cat));
                row.appendChild(cell);
                body.appendChild(row);
            }

            textNode.nodeValue = delayDev[cat].toFixed(2);
        } // for cat
    }

    intervalToken = setInterval(refreshCallbackStats, intervalPeriod);
    window.addEventListener("unload", function(ev) {
        if (intervalToken) {
            clearInterval(intervalToken);
        }
    });
});
</script>
</head>

<body>
<h1>retro-205 Diagnostic Monitor</h1>
<hr>
<table id=DiagTable border=1 cellpadding=1 cellspacing=0>
<colgoup>
    <col style="width:7em">
    <col style="width:12em">
</colgroup>
<thead>
<tr>
    <th>Delta (ms)<th>Category
<tbody id=DiagBody>
</table>
</body>
</html>